{include="header"}

<script type="text/javascript">
   function delete_pais(url)
   {
      if( confirm("¿Realmente desea eliminar este país?") )
         window.location.href = url;
   }
   $(document).ready(function() {
      
   });
</script>

<div class="table-responsive">
   <table class="table table-hover">
      <thead>
         <tr>
            <th class="text-left">
               <a href="http://es.wikipedia.org/wiki/ISO_3166-1#C.C3.B3digos_ISO_3166-1" target="_blank">Código Alfa-3</a>
            </th>
            <th class="text-left">
               <a href="http://es.wikipedia.org/wiki/ISO_3166-1#C.C3.B3digos_ISO_3166-1" target="_blank">Código Alfa-2</a>
            </th>
            <th class="text-left">Nombre</th>
            <th align="right" width="140">Acciones</th>
         </tr>
      </thead>
      {loop="$fsc->pais->all()"}
      <form action="{$fsc->url()}" method="post" class="form" role="form">
         <tr>
            <td>
               <input type="hidden" name="scodpais" value="{$value->codpais}"/>
               <div class="form-control">{$value->codpais}</div>
            </td>
            <td>
               <input class="form-control" type="text" name="scodiso" value="{$value->codiso}" autocomplete="off"/>
            </td>
            <td>
               <input class="form-control" type="text" name="snombre" value="{$value->nombre}" autocomplete="off"/>
            </td>
            <td class="text-right">
               <div class="btn-group">
                  <a class="btn btn-sm btn-danger" onclick="delete_pais('{$fsc->url()}&delete={$value->codpais}')" title="Eliminar">
                     <span class="glyphicon glyphicon-trash"></span>
                  </a>
                     
                  <button class="btn btn-sm btn-primary" type="submit" title="Guardar">
                     <span class="glyphicon glyphicon-floppy-disk"></span>
                  </button>
               </div>
            </td>
         </tr>
      </form>
      {/loop}
      <form class="form" role="form" name="f_nuevo_pais" action ="{$fsc->url()}" method="post">
         <tr class="bg-info">
            <td>
               <input class="form-control" type="text" name="scodpais" placeholder="Nuevo código Alfa-3" autocomplete="off"/>
            </td>
            <td>
               <input class="form-control" type="text" name="scodiso" placeholder="Código Alfa-2" autocomplete="off"/>
            </td>
            <td>
               <input class="form-control" type="text" name="snombre" placeholder="Nuevo nombre" autocomplete="off"/>
            </td>
            <td class="text-right">
               <button class="btn btn-sm btn-primary" type="submit" onclick="this.disabled=true;this.form.submit();" title="Guardar">
                  <span class="glyphicon glyphicon-floppy-disk"></span>
               </button>
            </td>
         </tr>
      </form>
   </table>
</div>

{include="footer"}